Bug 319849 - gtkcalendar look in RTL locales
authorYair Hershkovitz <yairhr@gmail.com>
Sat, 6 Sep 2008 21:31:30 +0000 (21:31 +0000)
committerYair Hershkovitz <yairhr@src.gnome.org>
Sat, 6 Sep 2008 21:31:30 +0000 (21:31 +0000)
2008-09-07  Yair Hershkovitz  <yairhr@gmail.com>

Bug 319849 - gtkcalendar look in RTL locales

* gtk/gtkcalendar.c (calendar_realize_week_numbers),
(gtk_calendar_realize): added missing RTL code to handle week numbers
from gtk_calendar_size_alloc.

svn path=/trunk/; revision=21306

ChangeLog
gtk/gtkcalendar.c

index 2c58446c2b670ff1fa6b392b9db063942469b97c..89f35ae2fbc89cad0ab010894352cb55d4aee2fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-07  Yair Hershkovitz  <yairhr@gmail.com>
+
+       Bug 319849 - gtkcalendar look in RTL locales
+
+       * gtk/gtkcalendar.c (calendar_realize_week_numbers),
+       (gtk_calendar_realize): added missing RTL code to handle week numbers
+       from gtk_calendar_size_alloc.
+
 2008-09-06  Sven Herzberg  <sven@imendio.com>
 
        Bug 551063 – deprecated marking without a link to what new code should
index 964b4bcbbd363a4b3923416ef7cdb369b81fa1c7..cf06ed608676bf55a5e43798e0b11cc30fb9bae7 100644 (file)
@@ -1542,7 +1542,10 @@ calendar_realize_week_numbers (GtkCalendar *calendar)
       attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
       
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-      attributes.x = widget->style->xthickness + INNER_BORDER;
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) 
+       attributes.x = widget->style->xthickness + INNER_BORDER;
+      else 
+       attributes.x = widget->allocation.width - priv->week_width - (widget->style->xthickness + INNER_BORDER);
       attributes.y = (priv->header_h + priv->day_name_h 
                      + (widget->style->ythickness + INNER_BORDER));
       attributes.width = priv->week_width;
@@ -1598,11 +1601,18 @@ gtk_calendar_realize (GtkWidget *widget)
                            | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
                            | GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
   
-  attributes.x = priv->week_width + (widget->style->ythickness + INNER_BORDER);
+  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) 
+    attributes.x = priv->week_width + (widget->style->ythickness + INNER_BORDER);
+  else
+    attributes.x = widget->style->ythickness + INNER_BORDER;
+
   attributes.y = (priv->header_h + priv->day_name_h 
                  + (widget->style->ythickness + INNER_BORDER));
   attributes.width = (widget->allocation.width - attributes.x 
                      - (widget->style->xthickness + INNER_BORDER));
+  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+    attributes.width -= priv->week_width;
+
   attributes.height = priv->main_h;
   priv->main_win = gdk_window_new (widget->window,
                                   &attributes, attributes_mask);